package com.xwj.dto;

import org.apache.commons.lang3.StringUtils;

import java.beans.Transient;
import java.io.Serializable;

public class HouseInfoDto implements Serializable {
    private static final long serialVersionUID = 7065876544347519922L;

    private String id;

    private String userId;

    private String phone;

    private String expireTime;

    private String status;

    private String cloudId;

    private String beginTime;

    private String endTime;

    public HouseInfoDto() {
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(String expireTime) {
        this.expireTime = expireTime;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getCloudId() {
        return cloudId;
    }

    public void setCloudId(String cloudId) {
        this.cloudId = cloudId;
    }

    public String getBeginTime() {
        return beginTime;
    }

    public void setBeginTime(String beginTime) {
        this.beginTime = beginTime;
    }

    public String getEndTime() {
        return endTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

    @Transient
    public void setExpireTimeScope(String expireTimeScope) {
        if (StringUtils.isBlank(expireTimeScope))
            return;
        String[] str = expireTimeScope.split(" - ");
        beginTime = str[0];
        endTime = str[1];
    }

    @Override
    public String toString() {

        StringBuilder builder = new StringBuilder();
        if (StringUtils.isNotBlank(id))
            builder.append(id);
        if (StringUtils.isNotBlank(userId))
            builder.append(userId);
        if (StringUtils.isNotBlank(phone))
            builder.append(phone);
        if (StringUtils.isNotBlank(expireTime))
            builder.append(expireTime);
        if (StringUtils.isNotBlank(status))
            builder.append(status);
        if (StringUtils.isNotBlank(cloudId))
            builder.append(cloudId);
        if (StringUtils.isNotBlank(beginTime))
            builder.append(beginTime);
        if (StringUtils.isNotBlank(endTime))
            builder.append(endTime);

        return builder.toString();
    }
}
